<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            var flag = false;
            $("#saveForm").find("input[isNull]").each(function(){
                var inputValue = $(this).val();
                if(undefined == inputValue || null == inputValue || "" == inputValue){
                    addError($(this),$(this).attr("isNull")+"不能为空.");
                    flag = false;
                    return false;
                }else{
                    flag = true;
                }
            });

            if(flag == false){
                return;
            }
            $("#btnSave").blur();
            showLoading();
            fy_api.ajaxSubmit($("#saveForm"),{
                success: function (data) {
                    hideLoading();
                    if (!isSuccess(data)) {
                        $.messager.alert('系统提示', data.msg, 'error', function () {
                            self.focus();
                        });
                    }
                }
            });
        });
        //编辑
        var keyId = $("#entityId").val();
        if(isNaN(keyId)){
            keyId = 0;
        }
        fy_api.ajax({
            data: {"keyId" :keyId},
            url: "weChatProgram/get.do",
            success: function (data) {
                if(null != data && undefined != data && null != data.content && undefined != data.content){
                    $("#saveForm").form('load',data.content);
                }
            }
        });
    });

    function turnBack() {
        parent.j_closeSelectedTab();
    }
</script>
<style>
    .div-label {
        width: 190px
    }

    .div-item{
        width : 90%
    }

    .div-item input{
        width : 90%
    }

    tr{
        width : 90%
    }

</style>
<form action="weChatProgram/save.do" method="post" id="saveForm" templateUrl="weChatProgram/get.do">
    <div id="divEdit">
        <input id="entityId" type="hidden" name="id"/>
    </div>
    <table style="margin: 10px auto;padding: 10px">
        <tr>
            <td>
                <div class="div-label">小程序应用ID：</div>
            </td>
            <td style="width: 80%;">
                <div class="div-item">
                    <input type="text" name="appid" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">小程序后台管理地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="host" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">上传图片地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="uploadFileUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">显示图片地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="showFileUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">根据银行卡号获取银行名：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="getBankNameUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">地图API KEY值：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="mapApiKey" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">金融平台接口地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="privilegeUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">交易中心接口地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="tradingcenterUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">保险平台接口地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="insuranceUrl" isNull/>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">保险结果通知地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="insuranceResultNotifyUrl" isNull/>
                </div>
            </td>
        </tr>
    </table>
</form>
<div class="form-buttons">
    <a id="btnSave" class="easyui-linkbutton" iconCls="icon-save">保存</a>
    <a id="btnBack" class="easyui-linkbutton c2" iconCls="icon-undo" onClick="turnBack();">返回</a>
</div>
